<style lang="scss" scoped>
.driver_pim {
  background-color: #fff;
  width: 100vw;
  .van-cell {
    padding-top: 20px;
    padding-bottom: 20px;
  }
  .upImg {
    position: relative;
    .img {
      opacity: 1;
      position: relative;
      right: 20px;
    }
    .icon {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      right: 0;
    }
    .van-uploader__input {
      margin-left: -10px;
    }
  }
}
</style>
<template>
  <div class="driver_pim">
    <!-- 个人信息 -->
    <van-nav-bar title="个人信息" left-arrow @click-left="$router.back()" />
    <div class="menu_list">
      <van-cell size="large" is-link center title="头像">
        <template #right-icon>
          <van-uploader class="upImg" :after-read="afterRead">
            <van-image
              round
              class="img"
              width="40"
              height="40"
              :src="$baseURL + $store.state.userInfo.head_photo"
            />
            <van-icon class="icon" size="18px" color="#9699A6" name="arrow" />
          </van-uploader>
        </template>
      </van-cell>
      <van-cell size="large" title="认证信息" is-link value="完整80%" />
      <van-cell size="large" title="车辆信息" is-link value="审核通过" />
      <van-cell size="large" title="保险金" is-link value="1000元" />
    </div>
  </div>
</template>

<script>
// import {upDatePhone} from '../api/user'
import { Toast } from "vant";
export default {
  data: () => ({
    selectSexBool: false,
    columnsSex: ["男", "女"],
    // userPhoto:'https://img.yzcdn.cn/vant/cat.jpeg'
  }),
  created() {
    this.init();
  },
  methods: {
    afterRead(file) {
      console.log(file);
      //   let params = new FormData();
      //   let id = 1;
      //   params.append("file", file.file);
      //   params.append("ID", id);
      //   let data = await upDatePhone(params);
      //   this.$store.commit("setUserHeadPhoto", data.data.msg);
      Toast.success("更改成功!");
    },
    init() {
      this.selectSexTxt = this.$store.state.userInfo.sex;
    },
  },
};
</script>